package com.zjn.zjngraduationdesign.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zjn.zjngraduationdesign.dao.UserDao;
import com.zjn.zjngraduationdesign.entity.User;
import com.zjn.zjngraduationdesign.service.UserService;
@Service
public class UserServiceImpl implements UserService{

	@Autowired
	UserDao userDao;
	
	@Override
	public boolean checkLogin(String username, String password) {
		boolean flag = false;
		User user = userDao.findUserByName(username);
		if(user != null && user.getUsername().equals(username) && user.getPassword().equals(password)) {
			flag = true;
		}else {
			flag = false;
		}
		return flag;
	}
	
	
	@Override
	public void addUser(User user) {
		userDao.addUser(user);
		
	}

}
